import { Component, OnInit } from '@angular/core';
import { BladeService } from "../../../shared/blade.service";
import { BladeData } from "../../../shared/blade/blade-data";
import { MenuListComponent } from "./menu-list/menu-list.component";
import { Blade } from "../../../shared/blade/blade.model";
import { Observable } from "rxjs/Observable";
import { CanDeactivateInterface } from "../../../service/guard/can-deactivate.Interface";

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css'],
  providers: [BladeService]
})
export class MenuComponent implements OnInit, CanDeactivateInterface  {
currentBlade:Blade
  constructor(public bladeService: BladeService) {

  }
  ngOnInit() {
    this.createMenuListBlade()
  }
  /**
   * 创建菜单列表弹出层
   * 
   * 
   * @memberof DicComponent
   */
  createMenuListBlade() {
    let data: BladeData = new BladeData();
    data.id = "menuList";
    data.title = "菜单列表";
    data.isClosingDisabled = true;
    this.currentBlade = this.bladeService.createBlade(MenuListComponent, data);
    this.bladeService.showBlade(this.currentBlade);
  }
  /**
   * 是否可以离开
   * 
   * 
   * @memberof DicComponent
   */
  canDeactivate(): boolean | Observable<boolean> | Promise<boolean> {
    return true;
  }
}



// WEBPACK FOOTER //
// ./src/app/module/admin/menu/menu.component.ts